from pydantic_settings import BaseSettings, SettingsConfigDict
from typing import List, Optional

class Settings(BaseSettings):
    model_config = SettingsConfigDict(
        env_file=".env",
        env_file_encoding='utf-8',
        extra="ignore"
    )

    APP_NAME: str = "aifreeforever-2api"
    APP_VERSION: str = "3.0.0"
    DESCRIPTION: str = "一个将 chat.aifreeforever.com 转换为兼容 OpenAI 格式 API 的高性能代理 (v3.0 - 普罗米修斯版)。"

    API_MASTER_KEY: Optional[str] = None
    
    # [战术升级 v3.0] 控制无头浏览器实例的数量
    BROWSER_INSTANCES: int = 5

    API_REQUEST_TIMEOUT: int = 180
    NGINX_PORT: int = 8088
    TARGET_URL: str = "https://chat.aifreeforever.com/"

    DEFAULT_MODEL: str = "openai/gpt-5-nano"
    KNOWN_MODELS: List[str] = [
        "alibaba/qwen-3-14b",
        "google/gemini-2.5-flash-lite",
        "meta/llama-3.1-8b",
        "mistral/ministral-3b",
        "openai/gpt-5-nano"
    ]

settings = Settings()
